<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
  <title>VForm Demo</title>
  <link rel="stylesheet" href="cdn.staticfile.org/element-ui/2.15.7/theme-chalk/index.min.css">
  <link rel="stylesheet" href="VFormBuilds/dist/VFormRender.css?t=20210730"> <!-- 根据Web服务器或CDN路径修改 -->
  <style type="text/css">
  </style>
</head>
<body>

<div id="app">
  <v-form-render :form-json="formJson" :form-data="formData" :option-data="optionData" ref="vFormRef">
  </v-form-render>
  <el-button type="primary" @click="submitForm">Submit</el-button>
</div>

<script type="text/javascript">
  if (!!window.ActiveXObject || "ActiveXObject" in window) { //IE load polyfill.js for Promise
    var scriptEle = document.createElement("script");
    scriptEle.type = "text/javascript";
    scriptEle.src = "https://cdn.bootcss.com/babel-polyfill/6.23.0/polyfill.min.js"
    document.body.appendChild(scriptEle)
  }
</script>
<script src="lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
<script src="cdn.staticfile.org/element-ui/2.15.7/index.min.js"></script>
<script src="VFormBuilds/dist/VFormRender.umd.min.js?t=20210730"></script> <!-- 根据Web服务器或CDN路径修改 -->
<script src="libs/jquery.min.js"></script>
<script src="plugins/layer/layer.js"></script>
<script src="js/common.js"></script>
<script>
  new Vue({
    el: '#app',
    data: {
      formJson: {"widgetList":[],"formConfig":{"labelWidth":80,"labelPosition":"left","size":"","labelAlign":"label-left-align","cssCode":"","customClass":"","functions":"","layoutType":"PC","onFormCreated":"","onFormMounted":"","onFormDataChange":"","onFormValidate":""}},
      formData: {},
      optionData: {}
    },
    methods: {
      submitForm: function() {
        this.$refs.vFormRef.getFormData().then( function(formData) {
          // Form Validation OK
          alert( JSON.stringify(formData) )
        }).catch( function(error) {
          // Form Validation Failed
          alert(error)
        })
      }
    }
  });
</script>
</body>
</html>